UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+teFdaZdCA2DhnxpBgyZ9ci3YmMf+0x8Mw1c/2rxl6E=' 
WHERE 
  key_id = '3aca478bef25793f78581b88735800d3e3ce8d8e67c43bf765c719958c070d75' 
  AND (
    token = '+teFdaZdCA2DhnxpBgyZ9ci3YmMf+0x8Mw1c/2rxl6E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00055