UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ERQpCcShTSSxFjgszTjfMMnC2E4pEtwE8TS3XRKA9Vw=' 
WHERE 
  key_id = '270b83e5229a8b781c0eba93d49b304ee803148b538d80627181fa4911109034' 
  AND (
    token = 'ERQpCcShTSSxFjgszTjfMMnC2E4pEtwE8TS3XRKA9Vw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035