UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4C3NWyDfJVAt+IBcJiivYuhs/0Oj9HmuN0sN+RMkrvk=' 
WHERE 
  key_id = '98ce0f7fe4183fd925e6e4f1fa928c5d76845deb93d5419e117740ec242edb6b' 
  AND (
    token = '4C3NWyDfJVAt+IBcJiivYuhs/0Oj9HmuN0sN+RMkrvk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017