UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eXD3J71fVZHByQL8nnSvOn5DAv6E+3c+yrAs7twLaos=' 
WHERE 
  key_id = '7c8442e77bddcf86bffea273fb343934b750b1e97678ea0734ef0a6dff0656fa' 
  AND (
    token = 'eXD3J71fVZHByQL8nnSvOn5DAv6E+3c+yrAs7twLaos=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034