UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '/1/AcP0k2bFrWGHw1DpNhn89/T7Knez2sOOFr3tUjn8=' 
WHERE 
  key_id = 'bedf5611bd0f90399978be32b94a642c33edc34f3639a071ca46edbdab4770be' 
  AND (
    token = '/1/AcP0k2bFrWGHw1DpNhn89/T7Knez2sOOFr3tUjn8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031