UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '59ZjyNhWsxQwaCfYG1whaB0g4YSpoVG6KqOiondkEBc=' 
WHERE 
  key_id = 'b2ccb7726a7f06d78d4f01f6ad52954d29c83817e79561eb4aeed3a3b839e7a9' 
  AND (
    token = '59ZjyNhWsxQwaCfYG1whaB0g4YSpoVG6KqOiondkEBc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024