UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'm6GRDMdfgSFBg//JEnfp8sw0FduABNg/aGB/XTc4aiQ=' 
WHERE 
  key_id = 'bef828c35b0d10fa4e97aae3842df343c81d486a21457a06b9a81b666123155c' 
  AND (
    token = 'm6GRDMdfgSFBg//JEnfp8sw0FduABNg/aGB/XTc4aiQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037