UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2547GUbkCOgS8sU/pRxQFEoh2TxSRN/trH/Fp9A7brM=' 
WHERE 
  key_id = '292897c5fce869a80465b80195d084f272dd4b60cfc7270371c1b2090f42f746' 
  AND (
    token = '2547GUbkCOgS8sU/pRxQFEoh2TxSRN/trH/Fp9A7brM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026