UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'm627uZuTenruXuFJU25ZnsBWQandOcrrYc4lsMoCmDc=' 
WHERE 
  key_id = 'acdcf5b4e1ac0712e21a359bb0bc1a260a3a347591e2f9734cab807977c89c9e' 
  AND (
    token = 'm627uZuTenruXuFJU25ZnsBWQandOcrrYc4lsMoCmDc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037