UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'khSncBIateCroTZLE3GHLtlvbi2+8qeaxU0H2pQgiFU=' 
WHERE 
  key_id = 'f9c79d93376aae8ea486802d87533a239105a19633524430bc61950438150109' 
  AND (
    token = 'khSncBIateCroTZLE3GHLtlvbi2+8qeaxU0H2pQgiFU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034