UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'l+cDcemKxrEC7mNArAgwcI3u0B0coabXz9McAQaYXwU=' 
WHERE 
  key_id = 'cbd9865291a93f7b80e3e33f90c8bfa33971bfc5c20db51236b071a0b3b56f2e' 
  AND (
    token = 'l+cDcemKxrEC7mNArAgwcI3u0B0coabXz9McAQaYXwU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019