UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xGCniPs7dD2p0kUu7phc9uF7e81V12Hy0kOdNyW6O1o=' 
WHERE 
  key_id = '6d1aa9fd631266e9fe3d71030310d76a14a16df7840497012b180f128292c4b2' 
  AND (
    token = 'xGCniPs7dD2p0kUu7phc9uF7e81V12Hy0kOdNyW6O1o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037