UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qrOrWME5Orl4ekFHfzn04nq+P/UOzMFJJAt7PqKYMiA=' 
WHERE 
  key_id = '0f4f31217cdc3eb437d2062113a9edb769c2899fed7786dbb53b54174286effe' 
  AND (
    token = 'qrOrWME5Orl4ekFHfzn04nq+P/UOzMFJJAt7PqKYMiA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029