UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GLNExT8ld8nKQDVNvwPhGFfOHBOB1RTHwjWtdLbkdNs=' 
WHERE 
  key_id = '8cf7af06004a0e391694d31cc8949aa51c5512084969b09bfb26473701e8fa71' 
  AND (
    token = 'GLNExT8ld8nKQDVNvwPhGFfOHBOB1RTHwjWtdLbkdNs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025