UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wQ22MyOK5rD4P6NByEttJ0008vi7whn+0YwPuPAHu7M=' 
WHERE 
  key_id = '04e9a460b86319b1b79410e30b271f20f0ec0326b660afd073556b16f3dcb6cf' 
  AND (
    token = 'wQ22MyOK5rD4P6NByEttJ0008vi7whn+0YwPuPAHu7M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048