UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uICbjY+88hCYgrIcDU8aEZrscLxjU59EsuxD2Js+Xeg=' 
WHERE 
  key_id = '449d39075ab5661faad6ee57441a4de0cd30f80d42cc84ff8a172bfb6041e479' 
  AND (
    token = 'uICbjY+88hCYgrIcDU8aEZrscLxjU59EsuxD2Js+Xeg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043