UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cL9VxCXJezuyhurkwK6fVPGdDG4otJahQK+sy7WieL8=' 
WHERE 
  key_id = '461d38e3258b751af598581a9c0498c2e7dc63b51fa82ca6fb677d7bb129b416' 
  AND (
    token = 'cL9VxCXJezuyhurkwK6fVPGdDG4otJahQK+sy7WieL8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025