UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nYkgtXM3+6IwzoF19z5ZI8sgBjg9tirvg0wK/bA30Lk=' 
WHERE 
  key_id = '30b78137bdf1473fd5729b3da391ce841ea74936c06f7cb41bf55c61d64aca5d' 
  AND (
    token = 'nYkgtXM3+6IwzoF19z5ZI8sgBjg9tirvg0wK/bA30Lk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022