UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jL67dH4sOZ0nWChd0M53LFKF34fcBczoGY5CLPQvTcQ=' 
WHERE 
  key_id = 'd9261b397e351fe758876b70033f90d2f9fa09ab31744009bb3ec66cfd41329d' 
  AND (
    token = 'jL67dH4sOZ0nWChd0M53LFKF34fcBczoGY5CLPQvTcQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031