UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zzvd7DUMzsBesN3Kq8T0NPLasHeonF+8CYIF5HH/nqI=' 
WHERE 
  key_id = '5044b1eab9b6b8671a372bca31ca45e560b971f69231d5e733daeff6fc17ce6b' 
  AND (
    token = 'zzvd7DUMzsBesN3Kq8T0NPLasHeonF+8CYIF5HH/nqI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040