UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'V1xfmwHMNQsxOfPT0CJOFhihRRbSzEQD8yjF7Rv3jZI=' 
WHERE 
  key_id = '5dd539e41ccb09936f3990224b35b0afe4191d33bf26121fcfbdccd6b5332840' 
  AND (
    token = 'V1xfmwHMNQsxOfPT0CJOFhihRRbSzEQD8yjF7Rv3jZI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030