UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ltN0L+0TTfuXZTx6xbSGN59rwk7Ledy4I9rvHTi36xA=' 
WHERE 
  key_id = '81456bc8f857b3442eae636a00d8e0d5ab34cd206c213a97a609b222ad389869' 
  AND (
    token = 'ltN0L+0TTfuXZTx6xbSGN59rwk7Ledy4I9rvHTi36xA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024