UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GxsgLqdSBB69wVPB+QC8QhSCiP8Fs7/i48GH+RZxuSY=' 
WHERE 
  key_id = 'af12c88dd722311db45947a4d3676787d1342e8027cbc5a5dbbb1826a9f03447' 
  AND (
    token = 'GxsgLqdSBB69wVPB+QC8QhSCiP8Fs7/i48GH+RZxuSY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037