UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2Gio+NLZcvWNkrM1JrZCyYOUo0P1LP+UdpzGeygJrEQ=' 
WHERE 
  key_id = '98f31e197fcbabc5d6a0934a6a8706d56939e2518f4d5ca1037bf76cd3fbdd9c' 
  AND (
    token = '2Gio+NLZcvWNkrM1JrZCyYOUo0P1LP+UdpzGeygJrEQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030