UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '/ioTXXoDZ0dgpY8W/SmouTH3dnGncAHbN+pUMCUkcGc=' 
WHERE 
  key_id = '496e82339d1c9386fbfd86bbe82d12cbc381212fd944a7ab9ac806f4a2165769' 
  AND (
    token = '/ioTXXoDZ0dgpY8W/SmouTH3dnGncAHbN+pUMCUkcGc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038