UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qrcHFZr0+ehFjuLi5H8oaZDpNbrLE0kuv1tdhgrXtjQ=' 
WHERE 
  key_id = '6bb5af8553a83d68862b82bd8057190f7cc0167750d2b3a5ba60c5761bb5d89f' 
  AND (
    token = 'qrcHFZr0+ehFjuLi5H8oaZDpNbrLE0kuv1tdhgrXtjQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046