UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qok81u5Dfois5ZhF+IDlPUn+r+Qq2LXnMhCUTNvdTAk=' 
WHERE 
  key_id = 'f37293b15c9c1acec509c87e4ae614ebda6c704c76ea27af8dbcabc045a8f141' 
  AND (
    token = 'qok81u5Dfois5ZhF+IDlPUn+r+Qq2LXnMhCUTNvdTAk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032